/*
 * Copyright the original author or authors.
 * 
 * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.mozilla.org/MPL/MPL-1.1.html
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 package com.blitscreen.utils
{
	import com.blitscreen.utils.monitor.RenderTimeField;	
	import com.blitscreen.utils.monitor.RenderPassCountField;	
	import com.blitscreen.render.RenderQueue;	
	import com.blitscreen.render.PostProcessPass;	
	import com.blitscreen.utils.monitor.AveragePostProcessTimeField;	
	import com.blitscreen.utils.monitor.PostProcessTimeField;	
	import com.blitscreen.render.DrawPass;
	import com.blitscreen.utils.monitor.AverageDrawTimeField;
	import com.blitscreen.utils.monitor.DrawTimeField;
	import com.blitscreen.utils.monitor.SpritesCountField;
	import com.bourre.structures.Range;
	import com.blitscreen.utils.monitor.AverageSpritesCountField;
	import com.blitscreen.utils.monitor.AverageRenderTimeField;
	import com.blitscreen.utils.monitor.AverageRenderPassCountField;		

	/**
	 * Utility class which provides convenient methods to access
	 * monitor's fields specific to the BlitScreen engine.
	 * <p>
	 * There is big difference with the classical monitor's fields
	 * utility class from Kairos : here members are functions and not
	 * constants. It's offer you to defines which <code>RenderPass</code>
	 * object fields will work on.
	 * 
	 * @author Cedric Nehemie
	 */
	public class RenderMonitorFields
	{
		/**
		 * 
		 * @param	pass
		 * @param	name
		 * @param	color
		 */
		static public function RENDER ( renderQueue : RenderQueue,
										name : String = "Render time", 
										color : Number = NaN ) : RenderTimeField
		{
			return new RenderTimeField( renderQueue, name, new Range( 0, 60 ), color );
		}
		
		/**
		 * 
		 * @param	pass
		 * @param	name
		 * @param	color
		 */
		static public function PASSES ( renderQueue : RenderQueue,
										name : String = "Passes count", 
										color : Number = NaN ) : RenderPassCountField
		{
			return new RenderPassCountField( renderQueue, name, new Range( 0, 15 ), color );
		}
		
		/**
		 * 
		 * @param	pass
		 * @param	name
		 * @param	color
		 */
		static public function DRAW ( 	pass : DrawPass,
										name : String = "Draw time", 
										color : Number = NaN ) : DrawTimeField
		{
			return new DrawTimeField( pass, name, new Range( 0, 30 ), color );
		}
			
		/**
		 * 
		 * @param	pass
		 * @param	name
		 * @param	color
		 */
		static public function SPRITES ( pass : DrawPass, 
										 name : String = "Sprites count",
										 color : Number = NaN ) : SpritesCountField
		{
			return new SpritesCountField( pass, name, new Range( 0, 100 ), color );
		}
		
		/**
		 * 
		 * @param	pass
		 * @param	name
		 * @param	color
		 */
		static public function POST_PROCESS ( pass : PostProcessPass, 
										 	  name : String = "Post-process time",
											  color : Number = NaN ) : PostProcessTimeField
		{
			return new PostProcessTimeField( pass, name, new Range( 0, 100 ), color );
		}
		
		/**
		 * 
		 * @param	pass
		 * @param	name
		 * @param	color
		 */
		static public function AVERAGE_RENDER ( renderQueue : RenderQueue,
												name : String = "Average Render time", 
												color : Number = NaN ) : AverageRenderTimeField
		{
			return new AverageRenderTimeField( renderQueue, name, new Range( 0, 60 ), color );
		}
		
		/**
		 * 
		 * @param	pass
		 * @param	name
		 * @param	color
		 */
		static public function AVERAGE_PASSES ( renderQueue : RenderQueue,
												name : String = "Average Passes count", 
												color : Number = NaN ) : AverageRenderPassCountField
		{
			return new AverageRenderPassCountField( renderQueue, name, new Range( 0, 15 ), color );
		}
		/**
		 * 
		 * @param	pass
		 * @param	name
		 * @param	color
		 */
		static public function AVERAGE_DRAW ( 	pass : DrawPass, 
												name : String = "Average draw time",
												color : Number = NaN ) : AverageDrawTimeField
		{
			return new AverageDrawTimeField( pass, name, new Range( 0, 30 ), 20, color );
		}
		
		/**
		 * 
		 * @param	pass
		 * @param	name
		 * @param	color
		 */
		static public function AVERAGE_SPRITES ( pass : DrawPass, 
												 name : String = "Average sprites count",
												 color : Number = NaN ) : AverageSpritesCountField
		{
			return new AverageSpritesCountField( pass, name, new Range( 0, 100 ), color );
		}
		
		/**
		 * 
		 * @param	pass
		 * @param	name
		 * @param	color
		 */
		static public function AVERAGE_POST_PROCESS ( pass : PostProcessPass, 
												 	  name : String = "Average post-process time",
												 	  color : Number = NaN ) : AveragePostProcessTimeField
		{
			return new AveragePostProcessTimeField( pass, name, new Range( 0, 100 ), color );
		}
	}
}